{extend name="book" /}
{block name="title"}
<title>详情</title>
<link rel="stylesheet" href="/html/layer_mobile/need/layer.css?2.0">
<script src="/html/layer_mobile/layer.js"></script>
{/block}

{block name="content"}
<body style="background: #F2F2F2">
<header data-am-widget="header" class="am-header am-header-default sq-head ">
    <div class="am-header-left am-header-nav">
        <a href="javascript:history.back()" class="">
            <i><img src="/html/img/back.png"/></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="" class="">详情</a>
    </h1>
</header>
<div style="height: 2rem"></div>

<div id="xq-text">
<div class="left">
    <img src="{$data.thumb_url}" alt="">
</div>
<div class="right">
   <p class="title">{$data.title}</p>
   <p class="title title-z">作者：{$data.author}</p>
   <p class="title title-z">分类：{$data.categoryName.name}</p>
    <p class="conner"></p>
    <div class="submit-text">
        <a href="{:url('index/read', ['id' => $data.id])}">
         <p class="two">开始阅读</p>
        </a>
    </div>

</div>
</div>
<div id="jj-text">
    <p class="title">
        图书简介
    </p>
    <p class="nr">
        {$data.description}
    </p>
</div>
<div class="talk">
    <p class="title">评论</p>
    <p class="more" >查看更多</p>
   <div class="pl">
       <ul>
           {foreach name="comment" item="c"}
           <li>
               <div class="r-r">
                   <p class="name">{$c.username.name}</p>
                   <p class="data">{$c.create_time}</p>
                   <p class="contnet">{$c.content}</p>
               </div>
           </li>
           {/foreach}
       </ul>
      <div class="p-post" style="">
          <input style="" placeholder="评论" type="text" id="content">
          <input style="float: right;border-radius: 5px;outline: none;border: none;background: #16a9ff;color: white" type="button" value="提交" id="comment">
      </div>
   </div>
</div>
<div id="like-book">
    <p>相似书籍</p>
    <div class="like-book">
        {foreach name="same_list" item="s"}
        <img src="{$s.thumb_url}" alt="">
        {/foreach}
    </div>
</div>

<div style="height: 2rem"></div>
<div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default sq-foot am-no-layout" id="">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">
        <li>
            <a href="/" class="curr">
                <span><img src="/html/img/q2.png"/></span>

            </a>
        </li>
        <li>
            <a href="{:url('index/zuji')}" class="">
                <span><img src="/html/img/w1.png"/></span>
            </a>
        </li>

        <li>
            <a href="{:url('index/shuku')}" class="">
                <span><img src="/html/img/e1.png"/></span>
            </a>
        </li>

    </ul>
</div>
{/block}

{block name="js"}
<script>
    $(function(){
        $('#comment').click(function () {
            if (content.length == 0) {
                layer.open({content: '评论内容不能为空',skin: 'msg',time: 2});
                return false;
            }
            var url = "{:url('index/comment')}";
            $.post(url, {content: $('#content').val(), book_id:"{$data.id}"}, function (res) {
                if(res.code == 1){
                    layer.open({content: res.msg, skin: 'msg',time: 2});
                    setTimeout(function () {
                        location.href = location.href;
                    }, 2000);
                }else{
                    layer.open({content: res.msg,skin: 'msg',time: 2});
                }
            });
        })

    })
</script>
{/block}